home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / allfiles / angry / shared.cst / 00001_Script_Movie Script next >
Text File  |  1999-03-01  |  3KB  |  170 lines

  1. global gLoopList
  2. global fileSep
  3.  
  4. on startMovie
  5.   set gLoopList = []  
  6.   --  set the exitLock to TRUE
  7.   initMovie
  8.   repeat with i = 1 to 6
  9.     if soundBusy(i) then sound stop i
  10.   end repeat
  11. end startMovie
  12.  
  13. on initMovie
  14.   if the machineType = 256 then
  15.     put "\" into fileSep
  16.   else  
  17.     put ":" into fileSep
  18.   end if
  19.   
  20.   set the keyDownScript to "keyCheck"
  21.   
  22. end initMovie
  23.  
  24. on keyCheck 
  25.   setVolume()
  26. end keyCheck
  27.  
  28. on setVolume  
  29.   set inKey = the key
  30.   
  31.   if inKey = "q" OR inKey = "Q" then go to frame "quitArtRight" of movie "intro"
  32.   
  33.   if charToNum(inKey) >= charToNum ("0") and charToNum (inKey) <= charToNum ("7") then
  34.     set newVol = integer (the key)
  35.     if the soundLevel <> newVol then set the soundLevel = newVol
  36.   end if  
  37. end setVolume
  38.  
  39.  
  40. --on idle
  41. --  checkExit  
  42. --end idle
  43. --
  44. --on checkExit
  45. --  if the commandDown and ¼
  46. --   (the key = "." or the key = "q") and ¼
  47. --   the exitLock = TRUE then 
  48. --    go to frame "quitARTWrong" of movie "intro"
  49. --  end if  
  50. --end checkExit
  51.  
  52.  
  53. on deg2radian thisMany -- convert degrees to radians
  54.   
  55.   return thisMany * ( (2 * pi()) / 360 )
  56.   
  57. end deg2radian
  58.  
  59. on radian2deg thisMany -- convert radians to degrees
  60.   
  61.   return integer(thisMany * ( 360 / (2 * pi()) ))
  62.   
  63. end radian2deg
  64.  
  65. on flyGravity theBody, thisMass, thatLoc, thatMass, maxRadius, action
  66.   
  67.   set body1 = theBody
  68.   set mass1 = thisMass
  69.   set gPoint = thatLoc
  70.   
  71.   set gMass = thatMass
  72.   set rMax = maxRadius
  73.   
  74.   set mouseMass = thisMass * 2
  75.   set mouseLoc = point(the mouseH, the mouseV)
  76.   
  77.   set deltaLoc = mouseLoc - the loc of sprite(body1)
  78.   
  79.   set dX = getAt(deltaLoc, 1)
  80.   set dY = getAt(deltaLoc, 2)
  81.   
  82.   set r = sqrt( dX*dX + dY*dY )
  83.   if r = 0  then set r = .01
  84.   
  85.   if r > 60 then set r = 60
  86.   
  87.   set G = 0.01
  88.   
  89.   set F = ( G * mass1 * mouseMass ) / r
  90.   
  91.   -- keep the objects close
  92.   
  93.   if action = "attract" then
  94.     set G = 0.01 * (r * 2.1) 
  95.   else
  96.     if r < rMax then -- if the bat's within rMax of the repulsor
  97.       set G = -0.01 * (r * 2.1)
  98.     else
  99.       set G = 0.0 -- else it has no effect
  100.     end if
  101.   end if
  102.   
  103.   set F = ( G * mass1 * gMass ) / r
  104.   
  105.   set Fx = 0
  106.   set Fy = 0 -- so no <void>s are returned
  107.   
  108.   
  109.   if dX <> 0.0 then
  110.     set Fx = F * dX / r
  111.     if abs( Fx ) > 2000 then
  112.       set Fx = 0.0
  113.     end if
  114.   end if
  115.   
  116.   if dY <> 0.0 then
  117.     set Fy = F * dY / r
  118.     if abs( Fy ) > 2000 then
  119.       set Fy = 0.0
  120.     end if
  121.   end if
  122.   
  123.   return [ #X:Fx, #Y:Fy ]
  124.   
  125. end flyGravity
  126.  
  127.  
  128.  
  129.  
  130.  
  131. on calcGravity theBody, thisMass
  132.   
  133.   set body1 = theBody
  134.   set mass1 = thisMass
  135.   
  136.   set mouseMass = thisMass * 2
  137.   set mouseLoc = point(the mouseH, the mouseV)
  138.   
  139.   set deltaLoc = mouseLoc - the loc of sprite(body1)
  140.   
  141.   set dX = getAt(deltaLoc, 1)
  142.   set dY = getAt(deltaLoc, 2)
  143.   
  144.   set r = sqrt( dX*dX + dY*dY )
  145.   if r = 0  then set r = .01
  146.   
  147.   if r > 60 then set r = 60
  148.   
  149.   set G = 0.01
  150.   
  151.   set F = ( G * mass1 * mouseMass ) / r    
  152.   
  153.   if dX <> 0.0 then
  154.     set Fx = F * dX / r
  155.     if abs( Fx ) > 2000 then
  156.       set Fx = 0.0
  157.     end if
  158.   end if
  159.   
  160.   if dY <> 0.0 then
  161.     set Fy = F * dY / r
  162.     if abs( Fy ) > 2000 then
  163.       set Fy = 0.0
  164.     end if
  165.   end if
  166.   
  167.   return [ #X:Fx, #Y:Fy ]
  168.   
  169. end
  170.